package com.controll.xstream;

import java.io.FileInputStream;
import java.io.InputStream;

import com.bean.xstream.userList.UserListVo;
import com.thoughtworks.xstream.XStream;

public class parseXml2BeanList {

	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception {	
		
		double startTime,endTime,totTime;			
		//URL url = new URL("http://192.168.1.72/SpPushUser?type=0&acc=&group_id=&status=0&page=1&pagecnts=25&staff=testAdmin&location=0:0:0:0:0:0:0:1");
		InputStream is = new FileInputStream( "data/userList.xml" );
		startTime = System.currentTimeMillis();
		
		XStream xStream = new XStream();
		xStream.processAnnotations(UserListVo.class);
		
		UserListVo userList = new UserListVo();
		userList = (UserListVo) xStream.fromXML(is);
		System.out.println(userList.getUserList().size());
		endTime = System.currentTimeMillis();
		totTime = endTime - startTime;
		System.out.println("Using Time: " + totTime/1000+" sec");
		
//		for(int i=0; i<userList.getUserList().size(); i++){
//			System.out.println(userList.getUserList().get(i).getName());
//		}
				
	}

}
